************************************************************************** 
* JPR Resolving Bargaining Problems in Civil Conflict replication codes  *
* Joo 2024 						   									     * 
* Models run on Dell Latitude 7420										 * 
* Windows 10 Enterprise (V.22H2)                                         *
* Processor: 11th Gen Intel(R) Core(TM) i7-1185G7 @ 3.00GHz   1.80 GHz   * 
* RAM: 16.0 GB (15.7 GB usable)    										 *
* STATA/SE 17.0                                                          * 
**************************************************************************

*********************
* Main Paper Models *
*********************

***********
* Table 1 *
***********
cd"Your Directory\JPR_Joo_replication2024"

use nego_maindata

cd"Your Directory\JPR_Joo_replication2024\Tables"

* Model 1
probit negotiation i.moderate##c.polyarchy T1 T2 T3, robust
outreg2 using Table1.doc, append ctitle(Model 1) dec(3) pdec(3) alpha (0.001, 0.01, 0.05, 0.1) symbol(***,**,*,+)

* Model 2
probit negotiation i.moderate##c.polyarchy islam communism terrcontrol pw  T1 T2 T3, robust
outreg2 using Table1.doc, append ctitle(Model 2) dec(3) pdec(3) alpha (0.001, 0.01, 0.05, 0.1) symbol(***,**,*,+)

* Model 3
probit negotiation i.moderate##c.polyarchy islam communism terrcontrol pw med_cwm rebsup govsup T1 T2 T3, robust
outreg2 using Table1.doc, append ctitle(Model 3) dec(3) pdec(3) alpha (0.001, 0.01, 0.05, 0.1) symbol(***,**,*,+)

* Model 4
probit negotiation i.moderate##c.polyarchy islam communism terrcontrol pw med_cwm rebsup govsup lbdbest parity war T1 T2 T3, robust
outreg2 using Table1.doc, append ctitle(Model 4) dec(3) pdec(3) alpha (0.001, 0.01, 0.05, 0.1) symbol(***,**,*,+)

clear

***********
* Table 2 *
***********
cd"Your Directory\JPR_Joo_replication2024"

use nego_maindata

cd"Your Directory\JPR_Joo_replication2024\Tables"

* Model 5 
probit negotiation moderate islam communism terrcontrol pw med_cwm rebsup govsup lbdbest parity war T1 T2 T3, robust
outreg2 using Table2.doc, append ctitle(Model 5) dec(3) pdec(3) alpha (0.001, 0.01, 0.05, 0.1) symbol(***,**,*,+)

* Model 6
probit negotiation polyarchy islam communism terrcontrol pw med_cwm rebsup govsup lbdbest parity war T1 T2 T3, robust
outreg2 using Table2.doc, append ctitle(Model 6) dec(3) pdec(3) alpha (0.001, 0.01, 0.05, 0.1) symbol(***,**,*,+)

* Model 7 
probit negotiation moderate polyarchy islam communism terrcontrol pw med_cwm rebsup govsup lbdbest parity war T1 T2 T3, robust
outreg2 using Table2.doc, append ctitle(Model 7) dec(3) pdec(3) alpha (0.001, 0.01, 0.05, 0.1) symbol(***,**,*,+)

* Model 8
logit negotiation i.moderate##c.polyarchy islam communism terrcontrol pw med_cwm rebsup govsup lbdbest parity war T1 T2 T3, robust
outreg2 using Table2.doc, append ctitle(Model 8) dec(3) pdec(3) alpha (0.001, 0.01, 0.05, 0.1) symbol(***,**,*,+)

* Model 9
rbiprobit negotiation i.moderate##c.polyarchy islam communism terrcontrol pw med_cwm rebsup govsup lbdbest parity war T1 T2 T3,  endog(moderate = islam communism terrcontrol pw rstrength rebsup centstrength lbdbest)
outreg2 using Table2.doc, append ctitle(Model 9) dec(3) pdec(3) alpha (0.001, 0.01, 0.05, 0.1) symbol(***,**,*,+)
		
* Model 10
cem islam communism terrcontrol rstrength centstrength lbdbest, treatment(moderate)

probit negotiation i.moderate##c.polyarchy islam communism terrcontrol pw med_cwm rebsup govsup lbdbest parity war T1 T2 T3 [iw=cem_weights], robust
outreg2 using Table2.doc, append ctitle(Model 10) dec(3) pdec(3) alpha (0.001, 0.01, 0.05, 0.1) symbol(***,**,*,+)

* Model 11
ivprobit negotiation moderate modpol islam communism terrcontrol pw med_cwm rebsup govsup lbdbest parity war T1 T2 T3 (polyarchy = demspell)
outreg2 using Table2.doc, append ctitle(Model 11) dec(3) pdec(3) alpha (0.001, 0.01, 0.05, 0.1) symbol(***,**,*,+)

clear 


***********
* Table 3 *
***********
cd"Your Directory\JPR_Joo_replication2024"

use nego_maindata

cd"Your Directory\JPR_Joo_replication2024\Tables"

* Model 12
probit moderate prnego islam communism terrcontrol rstrength centstrength lbdbest, robust
outreg2 using Table3.doc, append ctitle(Model 12) dec(3) pdec(3) alpha (0.001, 0.01, 0.05, 0.1) symbol(***,**,*,+)

* Model 13
probit moderate prnego2 islam communism terrcontrol rstrength centstrength lbdbest, robust
outreg2 using Table3.doc, append ctitle(Model 13) dec(3) pdec(3) alpha (0.001, 0.01, 0.05, 0.1) symbol(***,**,*,+)

* Model 14
probit moderate prnego3 islam communism terrcontrol rstrength centstrength lbdbest, robust
outreg2 using Table3.doc, append ctitle(Model 14) dec(3) pdec(3) alpha (0.001, 0.01, 0.05, 0.1) symbol(***,**,*,+)

* Model 15 
probit moderate prnego4 islam communism terrcontrol rstrength centstrength lbdbest, robust
outreg2 using Table3.doc, append ctitle(Model 15) dec(3) pdec(3) alpha (0.001, 0.01, 0.05, 0.1) symbol(***,**,*,+)

* Model 16
probit moderate prnego5 islam communism terrcontrol rstrength centstrength lbdbest, robust
outreg2 using Table3.doc, append ctitle(Model 16) dec(3) pdec(3) alpha (0.001, 0.01, 0.05, 0.1) symbol(***,**,*,+)

* Model 17
probit moderate negotiation islam communism terrcontrol rstrength centstrength lbdbest, robust
outreg2 using Table3.doc, append ctitle(Model 17) dec(3) pdec(3) alpha (0.001, 0.01, 0.05, 0.1) symbol(***,**,*,+)

* Model 18
probit moderate l1.negotiation islam communism terrcontrol rstrength centstrength lbdbest, robust
outreg2 using Table3.doc, append ctitle(Model 17) dec(3) pdec(3) alpha (0.001, 0.01, 0.05, 0.1) symbol(***,**,*,+)

clear


**************************
* Online Appendix Models *
**************************

*************
* Table A.2 *
*************
cd"Your Directory\JPR_Joo_replication2024"

use nego_maindata

cd"Your Directory\JPR_Joo_replication2024\Tables"

asdoc sum negotiation moderate polyarchy islam communism terrcontrol pw med_cwm rebsup govsup lbdbest parity war N inclusionmean local_process orientation Election_Asc NonDem_RebOfficer_Asc inherited NewOrg_Founder_Asc NewOrg_Split_Asc NewOrg_Merged_Asc ThirdParty_Asc rstrength centstrength demspell gdpcap_growth loda, save(TableA2) replace

clear

************
* Table A3 *
************
cd"Your Directory\JPR_Joo_replication2024"

use nego_maindata

cd"Your Directory\JPR_Joo_replication2024\Tables"

* Model A1
probit negotiation i.moderate##c.polyarchy islam communism terrcontrol pw med_cwm rebsup govsup lbdbest parity war gdpcap_growth loda N  T1 T2 T3, robust
outreg2 using TableA3.doc, append ctitle(Model A1) dec(3) pdec(3) alpha (0.001, 0.01, 0.05, 0.1) symbol(***,**,*,+)

* Model A2
probit negotiation i.moderate##c.polyarchy islam communism terrcontrol pw med_cwm rebsup govsup lbdbest parity war inclusionmean T1 T2 T3, robust
outreg2 using TableA3.doc, append ctitle(Model A2) dec(3) pdec(3) alpha (0.001, 0.01, 0.05, 0.1) symbol(***,**,*,+)

* Model A3
probit negotiation i.moderate##c.polyarchy islam communism terrcontrol pw med_cwm rebsup govsup lbdbest parity war  local_process orientation  T1 T2 T3, robust
outreg2 using TableA3.doc, append ctitle(Model A3) dec(3) pdec(3) alpha (0.001, 0.01, 0.05, 0.1) symbol(***,**,*,+)

* Model A4
probit negotiation i.moderate##c.polyarchy islam communism terrcontrol pw med_cwm rebsup govsup lbdbest parity war  Election_Asc  NonDem_RebOfficer_Asc inherited T1 T2 T3, robust
outreg2 using TableA3.doc, append ctitle(Model A4) dec(3) pdec(3) alpha (0.001, 0.01, 0.05, 0.1) symbol(***,**,*,+)

* Model A5
probit negotiation i.moderate##c.polyarchy islam communism terrcontrol pw med_cwm rebsup govsup lbdbest parity war NewOrg_Founder_Asc NewOrg_Split_Asc NewOrg_Merged_Asc ThirdParty_Asc T1 T2 T3, robust
outreg2 using TableA3.doc, append ctitle(Model A5) dec(3) pdec(3) alpha (0.001, 0.01, 0.05, 0.1) symbol(***,**,*,+)

clear

* Model A6
cd"Your Directory\JPR_Joo_replication2024"

use nagel_rep.dta

cd"Your Directory\JPR_Joo_replication2024\Tables"

logit negotiation gen_diff c.v2x_polyarchy##i.moderate v2x_cspart rgdppc_ln pop_ln dydur_ln i.intensitylevel ethnic weakrebels_2 activegroup tercont_2 rebexpsup_2 legalpolwing_2 strongcentralcommand_2 tsln tsln2 tsln3, cluster(ccode)
outreg2 using TableA3.doc, append ctitle(Model A6) dec(3) pdec(3) alpha (0.001, 0.01, 0.05, 0.1) symbol(***,**,*,+)

clear

* Model A7
cd"Your Directory\JPR_Joo_replication2024"

use NL_rep.dta

cd"Your Directory\JPR_Joo_replication2024\Tables"

logit negmntyn rebdis3mn govdis3mn bothdis3mn c.v2x_polyarchy##i.moderate lnrgdppc lnpop lnrugged ethfrac coldwar rebstrength2 time time2 time3, robust
outreg2 using TableA3.doc, append ctitle(Model A7) dec(3) pdec(3) alpha (0.001, 0.01, 0.05, 0.1) symbol(***,**,*,+)

clear


************
* Table A4 *
************
cd"Your Directory\JPR_Joo_replication2024"

use nego_maindata

cd"Your Directory\JPR_Joo_replication2024\Tables"

* Model A8
logit negotiation i.moderate##c.polyarchy T1 T2 T3, robust
outreg2 using TableA4.doc, append ctitle(Model A8) dec(3) pdec(3) alpha (0.001, 0.01, 0.05, 0.1) symbol(***,**,*,+)

* Model A9
logit negotiation i.moderate##c.polyarchy islam communism terrcontrol pw  T1 T2 T3, robust
outreg2 using TableA4.doc, append ctitle(Model A9) dec(3) pdec(3) alpha (0.001, 0.01, 0.05, 0.1) symbol(***,**,*,+)
 
* Model A10
logit negotiation i.moderate##c.polyarchy islam communism terrcontrol pw med_cwm rebsup govsup T1 T2 T3, robust
outreg2 using TableA4.doc, append ctitle(Model A10) dec(3) pdec(3) alpha (0.001, 0.01, 0.05, 0.1) symbol(***,**,*,+)

* Model A11
logit negotiation i.moderate##c.polyarchy islam communism terrcontrol pw med_cwm rebsup govsup lbdbest parity war T1 T2 T3, robust
outreg2 using TableA4.doc, append ctitle(Model A11) dec(3) pdec(3) alpha (0.001, 0.01, 0.05, 0.1) symbol(***,**,*,+)

clear 


************
* Table A5 *
************
cd"Your Directory\JPR_Joo_replication2024"

use nego_maindata

cd"Your Directory\JPR_Joo_replication2024\Tables"

* A12
rbiprobit negotiation i.moderate##c.polyarchy T1 T2 T3, endog(moderate= islam communism terrcontrol pw rstrength rebsup centstrength lbdbest)
outreg2 using TableA5.doc, append ctitle(Model A12) dec(3) pdec(3)  alpha (0.001, 0.01, 0.05, 0.1) symbol(***,**,*,+)

* A13
rbiprobit negotiation i.moderate##c.polyarchy islam communism terrcontrol pw  T1 T2 T3,  endog(moderate = islam communism terrcontrol pw rstrength rebsup centstrength lbdbest)
outreg2 using TableA5.doc, append ctitle(Model A13)  dec(3) pdec(3) alpha (0.001, 0.01, 0.05, 0.1) symbol(***,**,*,+)

* A14
rbiprobit negotiation i.moderate##c.polyarchy islam communism terrcontrol pw med_cwm rebsup govsup T1 T2 T3,  endog(moderate = islam communism terrcontrol pw rstrength rebsup centstrength lbdbest)
outreg2 using TableA5.doc, append ctitle(Model A14) dec(3) pdec(3) alpha (0.001, 0.01, 0.05, 0.1) symbol(***,**,*,+)

* A15
rbiprobit negotiation i.moderate##c.polyarchy islam communism terrcontrol pw med_cwm rebsup govsup lbdbest parity war T1 T2 T3,  endog(moderate = islam communism terrcontrol pw rstrength rebsup centstrength lbdbest)
outreg2 using TableA5.doc, append ctitle(Model A15) dec(3) pdec(3) alpha (0.001, 0.01, 0.05, 0.1) symbol(***,**,*,+)

clear 


************
* Table A6 *
************
cd"Your Directory\JPR_Joo_replication2024"

use nego_maindata

cd"Your Directory\JPR_Joo_replication2024\Tables"

cem islam communism terrcontrol rstrength centstrength lbdbest, treatment(moderate)

* Model A16
probit negotiation i.moderate##c.polyarchy T1 T2 T3 [iw=cem_weights], robust
outreg2 using TableA6.doc, append ctitle(Model A16) dec(3) pdec(3) alpha (0.001, 0.01, 0.05, 0.1) symbol(***,**,*,+)

* Model A17
probit negotiation i.moderate##c.polyarchy islam communism terrcontrol pw  T1 T2 T3 [iw=cem_weights], robust
outreg2 using TableA6.doc, append ctitle(Model A17) dec(3) pdec(3) alpha (0.001, 0.01, 0.05, 0.1) symbol(***,**,*,+)

* Model A18
probit negotiation i.moderate##c.polyarchy islam communism terrcontrol pw med_cwm rebsup govsup T1 T2 T3 [iw=cem_weights], robust
outreg2 using TableA6.doc, append ctitle(Model A18) dec(3) pdec(3) alpha (0.001, 0.01, 0.05, 0.1) symbol(***,**,*,+)

* Model A19
probit negotiation i.moderate##c.polyarchy islam communism terrcontrol pw med_cwm rebsup govsup lbdbest parity war T1 T2 T3 [iw=cem_weights], robust
outreg2 using TableA6.doc, append ctitle(Model A19) dec(3) pdec(3) alpha (0.001, 0.01, 0.05, 0.1) symbol(***,**,*,+)

clear


************
* Table A7 *
************
cd"Your Directory\JPR_Joo_replication2024"

use nego_maindata

cd"Your Directory\JPR_Joo_replication2024\Tables"

* gen modpol = moderate * polyarchy

* Model A20
ivprobit negotiation moderate modpol T1 T2 T3 (polyarchy = demspell)
outreg2 using TableA7.doc, append ctitle(Model A20) dec(3) pdec(3) alpha (0.001, 0.01, 0.05, 0.1) symbol(***,**,*,+)

* Model A21
ivprobit negotiation moderate modpol islam communism terrcontrol pw T1 T2 T3 (polyarchy = demspell) 
outreg2 using TableA7.doc, append ctitle(Model A21) dec(3) pdec(3) alpha (0.001, 0.01, 0.05, 0.1) symbol(***,**,*,+)
 
* Model A22
ivprobit negotiation moderate modpol islam communism terrcontrol pw med_cwm rebsup govsup T1 T2 T3 (polyarchy = demspell)
outreg2 using TableA7.doc, append ctitle(Model A22) dec(3) pdec(3) alpha (0.001, 0.01, 0.05, 0.1) symbol(***,**,*,+)

* Model A23
ivprobit negotiation moderate modpol islam communism terrcontrol pw med_cwm rebsup govsup lbdbest parity war T1 T2 T3 (polyarchy = demspell)
outreg2 using TableA7.doc, append ctitle(Model A23) dec(3) pdec(3) alpha (0.001, 0.01, 0.05, 0.1) symbol(***,**,*,+)

clear

************
* Table A8 *
************
cd"Your Directory\JPR_Joo_replication2024"

use nego_maindata

cd"Your Directory\JPR_Joo_replication2024\Tables"

* Model A24
probit negotiation polyarchy islam communism terrcontrol pw  T1 T2 T3, robust
*predict prnego 
outreg2 using TableA8.doc, append ctitle(Model A24) dec(3) pdec(3) alpha (0.001, 0.01, 0.05, 0.1) symbol(***,**,*,+)

* Model A25
probit negotiation polyarchy islam communism terrcontrol pw med_cwm rebsup govsup T1 T2 T3, robust
*predict prnego2
outreg2 using TableA8.doc, append ctitle(Model A25) dec(3) pdec(3) alpha (0.001, 0.01, 0.05, 0.1) symbol(***,**,*,+)

* Model A26
probit negotiation polyarchy islam communism terrcontrol pw med_cwm rebsup govsup lbdbest parity war T1 T2 T3, robust
*predict prnego3
outreg2 using TableA8.doc, append ctitle(Model A26) dec(3) pdec(3) alpha (0.001, 0.01, 0.05, 0.1) symbol(***,**,*,+)

* Model A27
probit negotiation polyarchy islam communism terrcontrol pw med_cwm rebsup govsup lbdbest parity war gdpcap_growth loda N  T1 T2 T3, robust
*predict prnego4
outreg2 using TableA8.doc, append ctitle(Model A27) dec(3) pdec(3) alpha (0.001, 0.01, 0.05, 0.1) symbol(***,**,*,+)

* Model A28
probit negotiation polyarchy islam communism terrcontrol pw med_cwm rebsup govsup lbdbest parity war inclusionmean T1 T2 T3, robust
*predict prnego5 
outreg2 using TableA8.doc, append ctitle(Model A28) dec(3) pdec(3) alpha (0.001, 0.01, 0.05, 0.1) symbol(***,**,*,+)

clear 

************
* Table A9 *
************
cd"Your Directory\JPR_Joo_replication2024"

use nego_maindata

cd"Your Directory\JPR_Joo_replication2024\Tables"

* Model A29
probit moderate prnego islam communism terrcontrol rstrength centstrength lbdbest, robust
outreg2 using TableA9.doc, append ctitle(Model A29) dec(3) pdec(3) alpha (0.001, 0.01, 0.05, 0.1) symbol(***,**,*,+)

* Model A30
probit moderate prnego2 islam communism terrcontrol rstrength centstrength lbdbest, robust
outreg2 using TableA9.doc, append ctitle(Model A30) dec(3) pdec(3) alpha (0.001, 0.01, 0.05, 0.1) symbol(***,**,*,+)

* Model A31
probit moderate prnego3 islam communism terrcontrol rstrength centstrength lbdbest, robust
outreg2 using TableA9.doc, append ctitle(Model A31) dec(3) pdec(3) alpha (0.001, 0.01, 0.05, 0.1) symbol(***,**,*,+)

* Model A32
probit moderate prnego4 islam communism terrcontrol rstrength centstrength lbdbest, robust
outreg2 using TableA9.doc, append ctitle(Model A32) dec(3) pdec(3) alpha (0.001, 0.01, 0.05, 0.1) symbol(***,**,*,+)

* Model A33
probit moderate prnego5 islam communism terrcontrol rstrength centstrength lbdbest, robust
outreg2 using TableA9.doc, append ctitle(Model A33) dec(3) pdec(3) alpha (0.001, 0.01, 0.05, 0.1) symbol(***,**,*,+)

* Model A34
probit moderate negotiation islam communism terrcontrol rstrength centstrength lbdbest, robust
outreg2 using TableA9.doc, append ctitle(Model A34) dec(3) pdec(3) alpha (0.001, 0.01, 0.05, 0.1) symbol(***,**,*,+)

* Model A35
probit moderate l1.negotiation islam communism terrcontrol rstrength centstrength lbdbest, robust
outreg2 using TableA9.doc, append ctitle(Model A35) dec(3) pdec(3) alpha (0.001, 0.01, 0.05, 0.1) symbol(***,**,*,+)

clear


************
* Table 10 *
************
cd"Your Directory\JPR_Joo_replication2024"

use nego_maindata

* sdtest polyarchy, by(moderate)

cd"Your Directory\JPR_Joo_replication2024\Tables"

asdoc ttest polyarchy, welch by(moderate) save(TableA10) replace


************
* Table 11 *
************

*mean(polyarchy)
*gen highpoly = 0 if polyarchy <= .3782925
*replace highpoly = 1 if polyarchy > .3782925
*replace highpoly = . if polyarchy ==. 

asdoc tab highpoly moderate, chi2 col save(TableA11) replace

clear

*** End of Do-file ***